package cdu.dx.controller;

import cdu.dx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @program: Java框架实验
 * @description:
 * @author: hanabi
 * @create: 2022-03-09 10:26
 **/
@RequestMapping("/user")
@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/list")
    public String list(Model model) {
        model.addAttribute("userList", userService.findAll());
        return "user_list";
    }
}
